<?php
// var_dump($_FILES);
// move_uploaded_file($_FILES['image']['tmp_name'],'./upload/'.$_FILES['iamge']['name'])
if(!empty($_POST)){
    if($_FILES['image']['error']==0){
        $path=uniqid('user').rand(100,500).$_FILES['image']['tmp_name'];
        move_uploaded_file($_FILES['image']['tmp_name'],'./upload/'.$path);
    }else{
        echo "上传失败"+$_FILES['image']['error'];
    }
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <form action="" enctype="multipart/form-data">
        <input type="file" name="image">
        <input type="submit" value="上传">
    </form>
</body>
</html>